#ifndef __H_TCPSERVER_H__
#define __H_TCPSERVER_H__
#include "Public.h"

namespace liu
{
	class Eventloop;
	class Acceptor;
	class TcpConnection;

	class TcpServer
	{
	public:		
		using ConnectionCallback = function<void (const shared_ptr<TcpConnection>& )>;
	public:
		TcpServer(Eventloop* pLoop);
		~TcpServer();

	public:
		void start();
		void newConnection(int sockfd);

	public:
		Eventloop* m_pLoop;
		unique_ptr<Acceptor> m_pAcceptor;
		ConnectionCallback m_ConnectionCallback;
		vector<shared_ptr<TcpConnection>> m_vecTcpconnections;
	};
}

#endif // !defined(__H_TCPSERVER_H__)